import { _decorator, Button, Component, Game, Node } from 'cc';
import { UIBase } from '../../ISUtility/Script/UI/UIBase';
import { UIRoot } from '../../ISUtility/Script/UI/UIRoot';
import { UISetting } from './UISetting';
import { GameWorld } from '../Gameplay/GameWorld';
const { ccclass, property } = _decorator;

@ccclass('UIMain')
export class UIMain extends UIBase {

    @property({type : Button})
    public StartGameBtn : Button = null;

    @property({type : Button})
    public SettingBtn : Button = null;

    start() {
        this.StartGameBtn.node.on(Button.EventType.CLICK,this.onStartGameBtn_Click,this);
        this.SettingBtn.node.on(Button.EventType.CLICK,this.onSettingBtn_Click,this);
    }

    update(deltaTime: number) {
        
    }

    protected override onShow(): void {

    }

    protected override onClose(): void {
        
    }

    protected override onHide(): void {
        
    }

    private onStartGameBtn_Click() {
        GameWorld.inst.StartGame();
    }

    private onSettingBtn_Click() {
        UIRoot.inst.OpenUI(UISetting);
    }
}


